<!DOCTYPE html>
<html xmlns:wb="http://open.weibo.com/wb">
<head>
  <meta charset="utf-8">
  <script src="https://cdn.jsdelivr.net/gh/Sanarous/files@1.13/js/linkcard.js"></script>
  <script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?fc9a8559a133f4d8ce784d69d6337bb0";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

  
  <title>Mongodb3.0.5副本集搭建及spring和java连接副本集配置 | 涂宗勋的博客</title>
  <meta name="baidu-site-verification" content="o8pWlgAEZ7" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="这是去年写的一篇文档，最近突然发现并没有发不出来，因此现在补上，希望能对某些朋友有所帮助。因为当时记录时没有截图，因此这里看起来可能就比较单调。">
<meta property="og:type" content="article">
<meta property="og:title" content="Mongodb3.0.5副本集搭建及spring和java连接副本集配置">
<meta property="og:url" content="https://tuzongxun.gitee.io/2016/11/07/mongo2/index.html">
<meta property="og:site_name" content="涂宗勋的博客">
<meta property="og:description" content="这是去年写的一篇文档，最近突然发现并没有发不出来，因此现在补上，希望能对某些朋友有所帮助。因为当时记录时没有截图，因此这里看起来可能就比较单调。">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2016-11-07T07:09:44.000Z">
<meta property="article:modified_time" content="2019-08-13T07:46:50.653Z">
<meta property="article:author" content="涂宗勋">
<meta property="article:tag" content="java">
<meta property="article:tag" content="数据库">
<meta property="article:tag" content="mongodb">
<meta name="twitter:card" content="summary">
  
  
    <link rel="icon" href="/images/touxiang.png">
  
  
    
  
  
<link rel="stylesheet" href="/tzxblog/css/style.css">

  

<meta name="generator" content="Hexo 4.2.1"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <script src="https://tjs.sjs.sinajs.cn/open/api/js/wb.js" type="text/javascript" charset="utf-8"></script>
  <script src="https://cdn.jsdelivr.net/gh/Sanarous/files@1.13/js/linkcard.js"></script>
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    
    <div id="header-inner" class="inner">
      <nav id="sub-nav">
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="https://tuzongxun.gitee.io"></form>
      </div>
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/tzxblog/">首页</a>
        
          <a class="main-nav-link" href="/tzxblog/shuoshuo/">说说</a>
        
          <a class="main-nav-link" href="/tzxblog/archives/">归档</a>
        
          <a class="main-nav-link" href="/tzxblog/collections/">导航</a>
        
          <a class="main-nav-link" href="/tzxblog/download/">资源</a>
        
          <a class="main-nav-link" href="/tzxblog/about/">简历</a>
        
      </nav>
      
    </div>
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/tzxblog/" id="logo">涂宗勋的博客</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/tzxblog/" id="subtitle">java程序员，现居武汉，CSDN博客https://blog.csdn.net/tuzongxun</a>&nbsp;&nbsp;&nbsp;&nbsp;
		  <!--<span id="busuanzi_container_site_pv">【本站累计访问量:<span id="busuanzi_value_site_pv"></span>】</span>-->
        </h2>
		
      
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-mongo2" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/tzxblog/2016/11/07/mongo2/" class="article-date">
  <time datetime="2016-11-07T07:09:44.000Z" itemprop="datePublished">2016-11-07</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/tzxblog/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/">数据库</a>
  </div>

</span>
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      Mongodb3.0.5副本集搭建及spring和java连接副本集配置
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <!-- Table of Contents -->
        
        <p>这是去年写的一篇文档，最近突然发现并没有发不出来，因此现在补上，希望能对某些朋友有所帮助。因为当时记录时没有截图，因此这里看起来可能就比较单调。</p>
<a id="more"></a>
<h3 id="基本环境："><a href="#基本环境：" class="headerlink" title="基本环境："></a>基本环境：</h3><blockquote>
<p>mongdb3.0.5数据库<br>spring-data-mongodb-1.7.2.jar<br>mongo-java-driver-3.0.2.jar<br>linux-redhat6.3<br>tomcat7</p>
</blockquote>
<h3 id="搭建mongodb副本集："><a href="#搭建mongodb副本集：" class="headerlink" title="搭建mongodb副本集："></a>搭建mongodb副本集：</h3><h4 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h4><p>分别在三台linux系统机上安装mongodb,(为避免和机器上原有的mongodb端口冲突，这里设为57017)：</p>
<blockquote>
<p>192.168.0.160<br>192.168.0.211（192.168.0.33上的虚拟机）<br>192.168.0.213（192.168.0.4上的虚拟机）</p>
</blockquote>
<p>每个mongodb的安装这里就不细说了，可以参考我的安装方面的文档，注意先不要更改用户验证方式。另外，这里如果没有三台机，也可以只用一台机开三个端口，同时准备三个数据存储目录。</p>
<h4 id="启动"><a href="#启动" class="headerlink" title="启动"></a>启动</h4><p>以副本集的方式启动三个mongodb：<br>只是在单机mongodb启动的基础上加入副本集参数—replSet，例如启动160的：</p>
<pre>
/home/admin/mongodb3051/mongodb305/bin/mongod –f  /home/admin/mongo3051/conf/mongodb.conf  --replSet reptest  
</pre>

<p>其中，reptest是指定的副本集名称，另外两台机也也要和这个一样。如：</p>
<pre>
/mongodb3051/mongodb305/bin/mongod –f /mongodb3051/conf/mongodb.conf  --replSet repTest  
</pre>

<h4 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h4><p>在任意一台机上配置副本集，这里在160上配置：</p>
<h5 id="进入160上的mongo-sehll-数据操作界面-："><a href="#进入160上的mongo-sehll-数据操作界面-：" class="headerlink" title="进入160上的mongo sehll(数据操作界面)："></a>进入160上的mongo sehll(数据操作界面)：</h5><pre>
/home/admin/mongodb3051/mongodb305/bin/mongo –port 57017  
</pre>
<h5 id="切换到admin数据库："><a href="#切换到admin数据库：" class="headerlink" title="切换到admin数据库："></a>切换到admin数据库：</h5><pre>
use admin  
</pre>
<h5 id="配置副本集："><a href="#配置副本集：" class="headerlink" title="配置副本集："></a>配置副本集：</h5><pre>
config={_id:”reptest”,members:[{_id:0,host:”192.168.0.160:57017”},{_id:1,host:”192.168.0.211:57017”},{_id:,host:”192.168.0.213:57017”}]}  
</pre>
<h5 id="加载副本集配置文件："><a href="#加载副本集配置文件：" class="headerlink" title="加载副本集配置文件："></a>加载副本集配置文件：</h5><pre>
rs.initiate(config)  
</pre>
<h5 id="查看副本集状态："><a href="#查看副本集状态：" class="headerlink" title="查看副本集状态："></a>查看副本集状态：</h5><pre>
rs.status()  
</pre>
<p>   正常情况下可以看到160会是主服务器，显示PRIMARY,如果是，就直接进行以下操作，如果不是，就切换到PRIMARY上进行以下操作（换到另一个mongo）；</p>
<h5 id="增加用户："><a href="#增加用户：" class="headerlink" title="增加用户："></a>增加用户：</h5><pre>
db.createUser({“user”:”admin”,”pwd”:”admin”,”roles”:[“root”]})  
</pre>
<h5 id="更改用户验证方式："><a href="#更改用户验证方式：" class="headerlink" title="更改用户验证方式："></a>更改用户验证方式：</h5><pre>
varschema=db.system.version.findOne({“_id”:”authSchema”})  
schema.currentVersion=3  
db.system.version.save(schema)  
</pre>
<h5 id="删除用户："><a href="#删除用户：" class="headerlink" title="删除用户："></a>删除用户：</h5><pre>
db.dropUser(“admin”)  
</pre>
<h5 id="重新建立用户-系统中和上边建立的用户验证方式不一样-："><a href="#重新建立用户-系统中和上边建立的用户验证方式不一样-：" class="headerlink" title="重新建立用户(系统中和上边建立的用户验证方式不一样)："></a>重新建立用户(系统中和上边建立的用户验证方式不一样)：</h5><pre>
db.createUser({“user”:”admin”,”pwd”:”admin”,”roles”:[“root”]})  
</pre>
<h5 id="关闭三个mongodb："><a href="#关闭三个mongodb：" class="headerlink" title="关闭三个mongodb："></a>关闭三个mongodb：</h5><pre>
db.shutDownServer()或者kill命令  
</pre>
<h5 id="在160的数据库的data目录中建立keyFile文件："><a href="#在160的数据库的data目录中建立keyFile文件：" class="headerlink" title="在160的数据库的data目录中建立keyFile文件："></a>在160的数据库的data目录中建立keyFile文件：</h5><pre>
cd /home/admin/mongodb3051/data  
openssl  rand  –base64 753  >  keyFile  
</pre>
<h5 id="给keyFile文件设置600权限（必须设置600权限）："><a href="#给keyFile文件设置600权限（必须设置600权限）：" class="headerlink" title="给keyFile文件设置600权限（必须设置600权限）："></a>给keyFile文件设置600权限（必须设置600权限）：</h5><pre>
chmod 600 keyFile  
</pre>
<h5 id="把这个keyFile文件上传到另外两台机上mongodb的data目录中："><a href="#把这个keyFile文件上传到另外两台机上mongodb的data目录中：" class="headerlink" title="把这个keyFile文件上传到另外两台机上mongodb的data目录中："></a>把这个keyFile文件上传到另外两台机上mongodb的data目录中：</h5><pre>
scp –r keyFile root@192.168.0.211/mongodb3051/data  
scp –r keyFile root@192.168.0.213/mongodb3051/data  
</pre>
<h5 id="在mongodb-conf文件中加入keyFile-例如160："><a href="#在mongodb-conf文件中加入keyFile-例如160：" class="headerlink" title="在mongodb.conf文件中加入keyFile,例如160："></a>在mongodb.conf文件中加入keyFile,例如160：</h5><pre>
keyFile=/home/admin/mongodb3051/data/keyFile  
</pre>
<h5 id="重新启动mongodb，使用replSet和auth参数："><a href="#重新启动mongodb，使用replSet和auth参数：" class="headerlink" title="重新启动mongodb，使用replSet和auth参数："></a>重新启动mongodb，使用replSet和auth参数：</h5><pre>
/home/admin/mongodb3051/mongodb305/bin/mongod –f /home/admin/mongo3051/conf/mongodb.conf --replSet reptest  --auth  
</pre>
<h5 id="在priority中设置副本集成员的优先级，给160设置最高优先级，优先级默认都是1："><a href="#在priority中设置副本集成员的优先级，给160设置最高优先级，优先级默认都是1：" class="headerlink" title="在priority中设置副本集成员的优先级，给160设置最高优先级，优先级默认都是1："></a>在priority中设置副本集成员的优先级，给160设置最高优先级，优先级默认都是1：</h5><pre>
config=rs.conf()  
config.members[0].priority=2  
rs.reconfig(config)  
</pre>
<p> 这样的话，只要160的mongodb是开着的，那么主服务器就会是160</p>
<h3 id="Spring中连接副本集的配置："><a href="#Spring中连接副本集的配置：" class="headerlink" title="Spring中连接副本集的配置："></a>Spring中连接副本集的配置：</h3><pre>
&lt;?xml version="1.0"encoding="UTF-8"?>  
&lt;beans xmlns="http://www.springframework.org/schema/beans"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"  
    xmlns:mongo="http://www.springframework.org/schema/data/mongo"  
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
            http://www.springframework.org/schema/data/mongo  
         http://www.springframework.org/schema/data/mongo/spring-mongo.xsd">  
    &lt;!-- Factory bean that creates the Mongoinstance -->  
    &lt;mongo:mongo-client replica-set="192.168.0.160:57017" credentials="admin:admin@admin" id="mongo">   
       &lt;mongo:client-options write-concern="SAFE" connections-per-host="100"  
            threads-allowed-to-block-for-connection-multiplier="50"  />   
    &lt;/mongo:mongo-client>   
    &lt;mongo:db-factory  id="mongoDbFactory"dbname="admin" mongo-ref="mongo"/>   
    &lt;bean id="mongoTemplate"class="org.springframework.data.mongodb.core.MongoTemplate">   
       &lt;constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />   
    &lt;/bean>    
&lt;/beans>  
</pre>
<p>只需要配置一个ip，就会自动切换。用户验证格式：username：password@dbname。</p>
<h3 id="java中连接副本集的代码："><a href="#java中连接副本集的代码：" class="headerlink" title="java中连接副本集的代码："></a>java中连接副本集的代码：</h3><pre>
public DB getMongoDB() {  
      try {  
        ServerAddress sa = new ServerAddress("192.168.0.160", 57017);  
        ServerAddress sa1 = new ServerAddress("192.168.0.211", 57017);  
        ServerAddress sa2 = new ServerAddress("192.168.0.213", 57017);  
        List<ServerAddress> sends = new ArrayList<ServerAddress>();  
        sends.add(sa);  
        sends.add(sa1);  
        sends.add(sa2);  
        List<MongoCredential> mongoCredentialList = new ArrayList<MongoCredential>();  
        mongoCredentialList.add(MongoCredential.createMongoCRCredential("admin", "admin","admin".toCharArray()));  
        DB mongoDB = new MongoClient(sends,mongoCredentialList).getDB("admin");  
      } catch (Exception e) {  
        throw new RuntimeException("连接MongoDB数据库错误", e);  
      }  
    return mongoDB;  
  }  
</pre>
<p>用户验证格式是：username，dbname，password</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="https://tuzongxun.gitee.io/2016/11/07/mongo2/" data-id="ckxn7cxhg0036kcvhc534am38" class="article-share-link">分享</a>
      
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tzxblog/tags/java/" rel="tag">java</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tzxblog/tags/mongodb/" rel="tag">mongodb</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tzxblog/tags/%E6%95%B0%E6%8D%AE%E5%BA%93/" rel="tag">数据库</a></li></ul>

    </footer>
  </div>
  
    
  <div class="comments" id="comments">
    
     
       
       
      
      
	 
  </div>
 
    
 
<script src="/tzxblog/jquery/jquery.min.js"></script>

  <div id="random_posts">
    <h2>推荐文章</h2>
    <div class="random_posts_ul">
      <script>
          var random_count =5
          var site = {BASE_URI:'/tzxblog/'};
          function load_random_posts(obj) {
              var arr=site.posts;
              if (!obj) return;
              // var count = $(obj).attr('data-count') || 6;
              for (var i, tmp, n = arr.length; n; i = Math.floor(Math.random() * n), tmp = arr[--n], arr[n] = arr[i], arr[i] = tmp);
              arr = arr.slice(0, random_count);
              var html = '<ul>';
            
              for(var j=0;j<arr.length;j++){
                var item=arr[j];
                html += '<li><strong>' + 
                item.date + ':&nbsp;&nbsp;<a href="' + (site.BASE_URI+item.uri) + '">' + 
                (item.title || item.uri) + '</a></strong>';
                if(item.excerpt){
                  html +='<div class="post-excerpt">'+item.excerpt+'</div>';
                }
                html +='</li>';
                
              }
              $(obj).html(html + '</ul>');
          }
          $('.random_posts_ul').each(function () {
              var c = this;
              if (!site.posts || !site.posts.length){
                  $.getJSON(site.BASE_URI + 'js/posts.js',function(json){site.posts = json;load_random_posts(c)});
              } 
               else{
                load_random_posts(c);
              }
          });
      </script>
    </div>
  </div>

	
<nav id="article-nav">
  
    <a href="/tzxblog/2017/01/30/activiti1/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">上一篇</strong>
      <div class="article-nav-title">
        
          activiti基础操作
        
      </div>
    </a>
  
  
    <a href="/tzxblog/2016/11/07/java1/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">下一篇</strong>
      <div class="article-nav-title">cookie、session和java过滤器理解和使用</div>
    </a>
  
</nav>

  
</article>

</section>
           
    <aside id="sidebar">
  
    <!--微信公众号二维码-->


  
    

  
    
  
    
    <div class="widget-wrap">
    
      <div class="widget" id="toc-widget-fixed">
      
        <strong class="toc-title">文章目录</strong>
        <div class="toc-widget-list">
              <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#基本环境："><span class="toc-number">1.</span> <span class="toc-text">基本环境：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#搭建mongodb副本集："><span class="toc-number">2.</span> <span class="toc-text">搭建mongodb副本集：</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#安装"><span class="toc-number">2.1.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#启动"><span class="toc-number">2.2.</span> <span class="toc-text">启动</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#配置"><span class="toc-number">2.3.</span> <span class="toc-text">配置</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#进入160上的mongo-sehll-数据操作界面-："><span class="toc-number">2.3.1.</span> <span class="toc-text">进入160上的mongo sehll(数据操作界面)：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#切换到admin数据库："><span class="toc-number">2.3.2.</span> <span class="toc-text">切换到admin数据库：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#配置副本集："><span class="toc-number">2.3.3.</span> <span class="toc-text">配置副本集：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#加载副本集配置文件："><span class="toc-number">2.3.4.</span> <span class="toc-text">加载副本集配置文件：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#查看副本集状态："><span class="toc-number">2.3.5.</span> <span class="toc-text">查看副本集状态：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#增加用户："><span class="toc-number">2.3.6.</span> <span class="toc-text">增加用户：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#更改用户验证方式："><span class="toc-number">2.3.7.</span> <span class="toc-text">更改用户验证方式：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#删除用户："><span class="toc-number">2.3.8.</span> <span class="toc-text">删除用户：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#重新建立用户-系统中和上边建立的用户验证方式不一样-："><span class="toc-number">2.3.9.</span> <span class="toc-text">重新建立用户(系统中和上边建立的用户验证方式不一样)：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#关闭三个mongodb："><span class="toc-number">2.3.10.</span> <span class="toc-text">关闭三个mongodb：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#在160的数据库的data目录中建立keyFile文件："><span class="toc-number">2.3.11.</span> <span class="toc-text">在160的数据库的data目录中建立keyFile文件：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#给keyFile文件设置600权限（必须设置600权限）："><span class="toc-number">2.3.12.</span> <span class="toc-text">给keyFile文件设置600权限（必须设置600权限）：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#把这个keyFile文件上传到另外两台机上mongodb的data目录中："><span class="toc-number">2.3.13.</span> <span class="toc-text">把这个keyFile文件上传到另外两台机上mongodb的data目录中：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#在mongodb-conf文件中加入keyFile-例如160："><span class="toc-number">2.3.14.</span> <span class="toc-text">在mongodb.conf文件中加入keyFile,例如160：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#重新启动mongodb，使用replSet和auth参数："><span class="toc-number">2.3.15.</span> <span class="toc-text">重新启动mongodb，使用replSet和auth参数：</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#在priority中设置副本集成员的优先级，给160设置最高优先级，优先级默认都是1："><span class="toc-number">2.3.16.</span> <span class="toc-text">在priority中设置副本集成员的优先级，给160设置最高优先级，优先级默认都是1：</span></a></li></ol></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Spring中连接副本集的配置："><span class="toc-number">3.</span> <span class="toc-text">Spring中连接副本集的配置：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#java中连接副本集的代码："><span class="toc-number">4.</span> <span class="toc-text">java中连接副本集的代码：</span></a></li></ol>
          </div>
      </div>
    </div>

  
    

  
    
  
    
  
    

  
</aside>

      </div>
      <footer id="footer">
  <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  
  <div class="outer">
    <div id="footer-left">
      &copy; 2016 - 2021 涂宗勋&nbsp; <a href="https://beian.miit.gov.cn/#/Integrated/recordQuery" target="_blank" rel="noopener">鄂ICP备20000142号</a> |&nbsp;&nbsp;
      主题 <a href="https://github.com/giscafer/hexo-theme-cafe/" target="_blank">Cafe</a>&nbsp;|&nbsp;&nbsp;
	  <span id="busuanzi_container_site_uv">本站有效访客数<span id="busuanzi_value_site_uv"></span>人</span>
	  <span id="busuanzi_container_site_pv" >| 总访问量 <span id="busuanzi_value_site_pv"></span> 次 </span>
	  <div style="width:300px;margin:0 auto; padding:20px 0;"><a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=42010302002171"style="display:inline-block;text-decoration:none;height:20px;line-height:20px;"><img src="http://www.tzxcode.cn/wp-content/uploads/2020/01/备案图标.png" style="float:left;"/><p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;">鄂公网安备 42010302002171号</p></a>
		 	</div>
    </div>
     <div id="footer-right">
      联系方式&nbsp;|&nbsp;1160569243@qq.com
    </div>
	
  </div>
</footer>
 
<script src="/tzxblog/jquery/jquery.min.js"></script>

 <script>
$(document).ready(function() {

    var int = setInterval(fixCount, 50);  // 50ms周期检测函数
    var countOffset = 20000;  // 初始化首次数据

    function fixCount() {            
       if (document.getElementById("busuanzi_container_site_pv").style.display != "none")
        {
            $("#busuanzi_value_site_pv").html(parseInt($("#busuanzi_value_site_pv").html()) + countOffset); 
            clearInterval(int);
        }                  
        if ($("#busuanzi_container_site_pv").css("display") != "none")
        {
            $("#busuanzi_value_site_uv").html(parseInt($("#busuanzi_value_site_uv").html()) + countOffset); // 加上初始数据 
            clearInterval(int); // 停止检测
        }  
    }
       	
});
</script> 
    </div>
    <nav id="mobile-nav">
  
    <a href="/tzxblog/" class="mobile-nav-link">首页</a>
  
    <a href="/tzxblog/shuoshuo/" class="mobile-nav-link">说说</a>
  
    <a href="/tzxblog/archives/" class="mobile-nav-link">归档</a>
  
    <a href="/tzxblog/collections/" class="mobile-nav-link">导航</a>
  
    <a href="/tzxblog/download/" class="mobile-nav-link">资源</a>
  
    <a href="/tzxblog/about/" class="mobile-nav-link">简历</a>
  
</nav>
    <img class="back-to-top-btn" src="/images/fly-to-top.png"/>
<script>
// Elevator script included on the page, already.
window.onload = function() {
  var elevator = new Elevator({
    selector:'.back-to-top-btn',
    element: document.querySelector('.back-to-top-btn'),
    duration: 1000 // milliseconds
  });
}
</script>
      

  

  







<!-- author:forvoid begin -->
<!-- author:forvoid begin -->

<!-- author:forvoid end -->

<!-- author:forvoid end -->



 
<script src="/tzxblog/js/is.js"></script>



  
<link rel="stylesheet" href="/tzxblog/fancybox/jquery.fancybox.css">

  
<script src="/tzxblog/fancybox/jquery.fancybox.pack.js"></script>




<script src="/tzxblog/js/script.js"></script>


<script src="/tzxblog/js/elevator.js"></script>

  </div>
</body>
</html>